<template>
    <div>
        <div>
            <el-form-item label="公告/活动标签">
                <el-input
                        v-model="marketName"
                        placeholder="请输入"
                ></el-input>
                <el-form-item>
                    <el-button type="primary" @click="findAll()">查询</el-button>
                </el-form-item>
            </el-form-item>
        </div>
        <div>
            <el-button type="primary" size="mini" @click="updateById"
            >新建</el-button>
            <el-table
                    :data="tableData"
                    style="width: 100%">

                <el-table-column
                        prop="eventType"
                        label="事件类型"
                        width="180">
                </el-table-column>
                <el-table-column
                        prop="theTheme"
                        label="公告/活动标题"
                        width="180">
                </el-table-column>
                <el-table-column
                        prop="theAuthor"
                        label="作者"
                        width="180">
                </el-table-column>

                <el-table-column label="操作" width="300">
                    <template slot-scope="scope">
                        <el-button type="primary" size="mini" @click="deleteById(scope.row.announcementId)"
                        >删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
    export default {
        data(){
            return{
                tableData:[],
                marketName:''
            }
        },
        created() {
            //查询我的基本信息
            this.findAll();
        },
        created() {
            //查询我的基本信息
            this.findAll();

        },
        methods: {
            findAll(){
                this.$axios
                    .get("/systemuser/sHuodong/findAll", {
                        params: {
                            //获取的周期
                            id: 1,
                            biaoti:this.marketName
                        },
                    })
                    .then((res) => {
                        this.tableData =  res.data;
                    });
            },

            deleteById(id){
                this.$axios
                    .get("/systemuser/sHuodong/delete", {
                        params: {
                            id: id,
                        },
                    })
            },
            updateById(id){
                //   直接调用$router.push 实现携带参数的跳转
                this.$router.push({
                    path: `/ActivityUp/${id}`})

            }
        }
    }
</script>

<style scoped>

</style>
